import os
import importlib
from database import close
from .startup import driver
modpath = './models/'


def run():

    lst = os.listdir(modpath)
    print(lst)
    for c in lst:
        if os.path.isfile(modpath+c) and c.endswith('.py') and\
           c.find("__init__") == -1:
            modname = c[0:-3]
            mod = importlib.import_module('models.'+modname)
            print(mod)
            mod.run()
    driver.close()
    close()


if __name__ == "__main__":
    run()
